import { Injectable } from '@nestjs/common'
import { AddAzureAppReq, UpdateAzureAppReq } from 'src/dtos/azure-app.dto'
import { RepositoryService } from './repository.service'
import { AzureApp } from 'src/typings'

@Injectable()
export class AzureAppService {

  private readonly repo: RepositoryService<AzureApp>

  constructor() {
    this.repo = new RepositoryService('azure-app.json', 'clientId')
  }

  public query() {
    return this.repo.getAll()
  }

  public add(dto: AddAzureAppReq) {
    return this.repo.add(dto)
  }

  public update(dto: UpdateAzureAppReq) {
    return this.repo.update(dto)
  }

  public delete(clientId: string) {
    return this.repo.delete(clientId)
  }

}
